/* 类型注解 */
(() => {
    function greeter(person) {
        return 'Hello, ' + person;
    }
    let user = 'Yee';
    console.log(greeter(user));
    // console.log(greeter(12)) // 类型“number”的参数不能赋给类型“string”的参数
})();
/* 接口 */
(() => {
    function greeter(person) {
        return 'Hello, ' + person.firstName + ' ' + person.lastName;
    }
    let user = {
        firstName: 'Yee',
        lastName: 'Huang'
    };
    console.log(greeter(user));
})();
/* 类 */
(() => {
    class User {
        constructor(firstName, lastName) {
            this.firstName = firstName;
            this.lastName = lastName;
            this.fullName = firstName + ' ' + lastName;
        }
    }
    function greeter(person) {
        return 'Hello, ' + person.firstName + ' ' + person.lastName;
    }
    let user = new User('Yee', 'Huang');
    console.log(greeter(user));
})();
